import { reactive } from 'vue'

interface User{
  email: string;
  password: string;
}
interface Rules{
  email: {
    type: string;
    message: string;
    trigger: string;
    required: boolean;
  }[];
  password: ({
    message: string;
    trigger: string;
    required: boolean;
    min?: undefined;
    max?: undefined;
  } | {
    min: number;
    max: number;
    message: string;
    trigger: string;
    required?: undefined;
  })[];
}

export const loginUser = reactive<User>({
  email:"",
  password:""
})


export const rules = reactive<Rules>({
  email: [{ type:"email",message:"邮箱格式不正确", trigger: 'blur',required: true }],
  password: [
    { message:"请填写密码", trigger: 'blur',required: true },
    { min:4,max:30,message:"密码长度应为4-30字符之间",trigger:'blur'}
  ],
})